﻿using System.Collections;
using System.Collections.Generic;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

public class LobbyPanel : MonoBehaviour
{
    [SerializeField] GameObject createRoomPanel;
    [SerializeField] GameObject joinRoomPanel;
    [SerializeField] Button createRoomBT;
    [SerializeField] Button joinRoomBT;
    [SerializeField] Button exitBT;
    
    private void OnEnable()
    {
        createRoomBT.onClick.AddListener(CreateRoom);
        joinRoomBT.onClick.AddListener(JoinRoom);
        exitBT.onClick.AddListener(Exit);
    }

    private void OnDisable()
    {
        createRoomBT.onClick.RemoveListener(CreateRoom);
        joinRoomBT.onClick.RemoveListener(JoinRoom);
        exitBT.onClick.RemoveListener(Exit);
    }

    void Exit()
    {
        gameObject.SetActive(false);
    }

    void CreateRoom()
    {
        createRoomPanel.SetActive(true);
    }

    void JoinRoom()
    {
        joinRoomPanel.SetActive(true);
    }
}
